package jjn.acwing.java_basic;

import java.util.Scanner;

/**
 * @author Jjn
 * @since 2023/9/3 22:21
 */
public class Acwing752 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String s = scanner.next();
            double[][] m = new double[12][12];
            for (int i = 0; i < 12; i++) {
                for (int j = 0; j < 12; j++) {
                    m[i][j] = scanner.nextDouble();
                }
            }
            double total = 0;
            int count = 0;
            for (int i = 1; i <= 5; i++) {
                for (int j = 12 - i; j < 12; j++) {
                    total += m[i][j];
                    count++;
                }
            }
            for (int i = 6; i <= 10; i++) {
                for (int j = i + 1; j < 12; j++) {
                    total += m[i][j];
                    count++;
                }
            }
            if ("S".equals(s)) {
                System.out.printf("%.1f", total);
            } else {
                System.out.printf("%.1f", total / count);
            }
        }
    }
}
